#include "widget.h"
#include "ui_widget.h"
#include <QPushButton>
#include <QDebug>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

    QPushButton *button = new QPushButton(this);
    button->setText("按钮");

    connect(button,&QPushButton::clicked,this,&Widget::handle);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::handle()
{
    //获取窗口的位置和尺寸信息
    QRect rect1 = this->geometry();         //不考虑 windows frame
    QRect rect2 = this->frameGeometry();    //考虑 windows frame

    qDebug() <<rect1;
    qDebug() <<rect2;
}

